Tools Overview
Tools give BindAI agents the ability to interact with application code and external systems. A tool is a callable capability that an agent can use when additional functionality is required. Tools can be used for:- Calling APIs
- Querying databases
- Searching documents
- Performing calculations
- Reading or writing application data
- Executing business logic
- Integrating with external services
What Is a Tool?
A BindAI tool represents an operation that an agent can execute. The underlying operation can be a normal Python function.Creating a Tool
BindAI provides atool decorator for defining tools.
Registering a Tool
A tool can be registered with an agent using.tool().
Registering Multiple Tools
Use.tools() when an agent needs several capabilities.
How Tool Calling Works
At a high level, tool-enabled execution follows this process:Why Use Tools?
A language model does not automatically have access to application-specific capabilities or current external data. Tools can provide access to:- Live data
- Internal APIs
- Databases
- Deterministic calculations
- Application state
- Business operations
- External services
- Knowledge retrieval
Tool Parameters
Tool parameters are defined by the Python function signature.query— the search querylimit— the maximum number of results
Type Hints
Type hints make tools easier to understand and integrate.Tool Descriptions
Tool descriptions should clearly explain what an operation does. For example:- What the tool does
- When it should be used
- What its important parameters represent
- What kind of result it returns
Multiple Tool Calls
An agent execution can involve more than one tool call. For example:Tool Execution
When a model requests a registered tool, BindAI executes the associated callable. Conceptually:Tool Results
Tool execution produces a result that is handled by BindAI’s tool execution system. The result can represent successful output or an execution error. Application code should generally allow the agent execution layer to coordinate tool results rather than implementing provider-specific tool-call handling. For example, a tool can simply return its application result:Tool Errors
Tools can fail during execution. For example:Reusing Tools
Tools can be reused across multiple agents.- Search
- Data retrieval
- Calculations
- Internal APIs
- External service operations
Tools and Agent Configuration
Tools are part of an agent’s capabilities and can be configured alongside its model, instructions, memory, knowledge, and other execution features. For example:Tool Context
Some tools may need access to information beyond their explicit function arguments. BindAI tools can participate in the execution context used by the agent. This can be useful for applications involving:- Runtime metadata
- Execution state
- Workflow state
- Application state
- User-specific information
- External service configuration
Tools and Memory
Tools can work alongside BindAI memory. For example, an agent might use:Tools and Knowledge
Tools can also complement BindAI’s knowledge and retrieval capabilities. For example:Tools and Workflows
Tools can participate in workflow-driven applications. A workflow can coordinate agent execution while tools provide individual capabilities. Conceptually:External Services
Tools are a natural interface for external services. Examples include:- REST APIs
- Databases
- Search services
- SaaS platforms
- Internal business systems
- Other application services
Designing Good Tools
Good tools should have a clear and limited responsibility. For example, prefer:Tool Security
Tools can give an agent access to real application capabilities, so they should be treated as application boundaries. Consider:- Validate external inputs.
- Limit access to sensitive operations.
- Avoid exposing credentials to the model.
- Avoid returning secrets in tool results.
- Apply appropriate authorization in application code.
- Keep destructive operations narrowly scoped.
- Validate data before writing to external systems.
Tool Side Effects
Some tools only read information, while others modify application state. Examples of read operations:Testing Tools
Tools should be tested independently from the language model whenever possible. A deterministic tool can be tested like normal Python application code:- Tool registration
- Parameter handling
- Successful execution
- Error handling
- External service failures
- Security and authorization
- Tool output formatting
Tool Calling and Providers
Tool calling is coordinated between BindAI and the selected model provider. The provider determines how tool calls are represented to the model, while BindAI manages the application-level tool execution. This architecture allows tools to remain largely independent of a specific provider. Conceptually:Tools and Multi-Agent Systems
Tools can be assigned to different specialist agents. For example:Best Practices
- Give each tool one clear responsibility.
- Use descriptive function and parameter names.
- Add Python type hints.
- Write concise and accurate tool descriptions.
- Validate external inputs.
- Keep tool outputs focused and useful.
- Handle expected failures gracefully.
- Avoid exposing secrets through tool inputs or outputs.
- Apply authorization in application code.
- Keep destructive operations narrowly scoped.
- Avoid unnecessary side effects.
- Reuse common tools across agents.
- Prefer several focused tools over one large tool.
- Test tools independently from the language model.
- Use workflows for complex orchestration.
- Use dedicated connections when an external integration benefits from a reusable connection boundary.
Summary
Tools extend BindAI agents with capabilities beyond language generation. The primary registration APIs are:@tool decorator:
